package com.heima.wemedia.listener;

import com.heima.common.constants.mq.NewsAutoScanConstants;
import com.heima.wemedia.service.WmNewsAutoScanService;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class WmListener {
    @Autowired
    WmNewsAutoScanService service;

    @RabbitListener(queuesToDeclare = @Queue(NewsAutoScanConstants.WM_NEWS_AUTO_SCAN_QUEUE))
    public void autoScanListener(String newsId){
        int i = Integer.parseInt(newsId);
        service.autoScanWmNews(i);
    }
}
